alert http2 any any -> any any (msg:"SURICATA HTTP2 user info in uri"; flow:established,to_server; app-layer-event:http2.userinfo_in_uri; classtype:protocol-command-decode; sid:2290014; rev:1;)
alert http2 any any -> any any (msg:"SURICATA HTTP2 reassembly limit reached"; flow:established; app-layer-event:http2.reassembly_limit_reached; classtype:protocol-command-decode; sid:2290015; rev:1;)
alert http2 any any -> any any (msg:"SURICATA HTTP2 data on stream zero"; flow:established; app-layer-event:http2.data_stream_zero; classtype:protocol-command-decode; sid:2290018; rev:1;)
+# disabled by default, as it can happen in legit cases depending on the max-frames config value
+# alert http2 any any -> any any (msg:"SURICATA HTTP2 too many frames"; flow:established; app-layer-event:http2.too_many_frames; classtype:protocol-command-decode; sid:2290019; rev:1;)
// maximum size of reassembly for header + continuation
static mut HTTP2_MAX_REASS: usize = 102400;
static mut HTTP2_MAX_STREAMS: usize = 4096; // 0x1000
+static mut HTTP2_MAX_FRAMES: usize = 65536;
#[repr(u8)]
#[derive(Copy, Clone, PartialOrd, PartialEq, Eq, Debug)]
UserinfoInUri,
ReassemblyLimitReached,
DataStreamZero,
+ TooManyFrames,
}
pub struct HTTP2DynTable {
let ftype = head.ftype;
let sid = head.stream_id;
let padded = head.flags & parser::HTTP2_FLAG_HEADER_PADDED != 0;
- if dir == Direction::ToServer {
- tx.frames_ts.push(HTTP2Frame {
- header: head,
- data: txdata,
- });
+ let h2frames = if dir == Direction::ToServer {
+ &mut tx.frames_ts
} else {
- tx.frames_tc.push(HTTP2Frame {
+ &mut tx.frames_tc
+ };
+ if h2frames.len() < unsafe { HTTP2_MAX_FRAMES } {
+ h2frames.push(HTTP2Frame {
header: head,
data: txdata,
});
+ } else {
+ tx.tx_data.set_event(HTTP2Event::TooManyFrames as u8);
}
if ftype == parser::HTTP2FrameType::Data as u8 && sid == 0 {
tx.tx_data.set_event(HTTP2Event::DataStreamZero as u8);
SCLogError!("Invalid value for http2.max-streams");
}
}
+ if let Some(val) = conf_get("app-layer.protocols.http2.max-frames") {
+ if let Ok(v) = val.parse::<usize>() {
+ HTTP2_MAX_FRAMES = v;
+ } else {
+ SCLogError!("Invalid value for http2.max-frames");
+ }
+ }
if let Some(val) = conf_get("app-layer.protocols.http2.max-table-size") {
if let Ok(v) = val.parse::<u32>() {
HTTP2_MAX_TABLESIZE = v;